var baseUrl = "http://localhost:8088/Grade";


function analyseURL()
{

	pageHead();
	if(analyseSearch("title") == "register")
	{
		registerPage();
	}
	else if(analyseSearch("title") == "login")
	{
		loginPage();
	}
	else if(analyseSearch("title") == "task" || analyseSearch("title") == null)
	{
		taskPage();
	}
	else if(analyseSearch("title") == "taskShow")
	{
		taskShowPage();
	}
	else if(analyseSearch("title") == "grade")
	{
		gradePage();
	}
	else if(analyseSearch("title") == "user")
	{
		userPage();
	}
	else if(analyseSearch("title") == "newTask")
	{
		newTaskPage();
	}
	else if(analyseSearch("title") == "gradeShow")
	{
		gradeShowPage();
	}
	else if(analyseSearch("title") == "teacher" || analyseSearch("title") == "student")
	{
		teacherOrStudentPage();
	}
	else if(analyseSearch("title") == "teacherShow" || analyseSearch("title") == "studentShow")
	{
		teacherOrStudentShowPage();
	}
	
}

function getCookie(val)
{
	let cookies = document.cookie.split(";");
	let pair;
	for(let i = 0; i < cookies.length; i++)
	{
		pair = cookies[i].split("=");
		if(pair[0].trim() == val)
		{
			return parseInt(pair[1]);
		}
	}
	return "";
}

function analyseSearch(data)
{
	return new URLSearchParams(location.search).get(data);
}